/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ownPackage;

import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JTextField;

/**
 *
 * @author FERMYTH
 */
public class FileChooser {
    public FileChooser(JTextField textField, int DirOnly){
        //Create a file chooser
        final JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(DirOnly);
        //In response to a button click:
        int returnVal = fc.showOpenDialog(null);

        if(returnVal == JFileChooser.APPROVE_OPTION){
            File f = fc.getSelectedFile();
            textField.setText(f.getAbsolutePath());

        }
    }
}
